[HVM] Qemu rtl8139: correct rx CRC calculation
authorTim Deegan <Tim.Deegan@xensource.com>
Mon, 16 Jul 2007 13:28:54 +0000 (14:28 +0100)
committerTim Deegan <Tim.Deegan@xensource.com>
Mon, 16 Jul 2007 13:28:54 +0000 (14:28 +0100)
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
tools/ioemu/hw/rtl8139.c

index df4f3eebdd060e9667461bf6072f71e8b0891a68..5e8ae9bba2d1f9780eebd054e8a6338c8b70cd22 100644 (file)
@@ -53,9 +53,8 @@
 /* debug RTL8139 card C+ mode only */
 //#define DEBUG_RTL8139CP 1
 
-/* RTL8139 provides frame CRC with received packet, this feature seems to be
-   ignored by most drivers, disabled by default */
-//#define RTL8139_CALCULATE_RXCRC 1
+/* Calculate CRCs propoerly on Rx packets */
+#define RTL8139_CALCULATE_RXCRC 1
 
 /* Uncomment to enable on-board timer interrupts */
 //#define RTL8139_ONBOARD_TIMER 1
@@ -1030,7 +1029,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
 
         /* write checksum */
 #if defined (RTL8139_CALCULATE_RXCRC)
-        val = cpu_to_le32(crc32(~0, buf, size));
+        val = cpu_to_le32(crc32(0, buf, size));
 #else
         val = 0;
 #endif
@@ -1136,7 +1135,7 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
 
         /* write checksum */
 #if defined (RTL8139_CALCULATE_RXCRC)
-        val = cpu_to_le32(crc32(~0, buf, size));
+        val = cpu_to_le32(crc32(0, buf, size));
 #else
         val = 0;
 #endif